home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-21 | 1.6 KB | 66 lines | [TEXT/MPS ] |
- (*
- TCPCharsAvailable(connectionID) -- Return the number of characters available for reading from the TCP connection.
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w TCPCharsAvailable.p
- link -m ENTRYPOINT -o HyperCommands -rt XFCN=7862 -sn Main=TCPCharsAvailable ∂
- TCPCharsAvailable.p.o "{Libraries}HyperXLib.o" "{MPW}"Libraries:interface.o
-
- © Copyright 1988 by Apple Computer, Inc.
-
- Initial coding 12/88 by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S TCPCharsAvailable } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- procedure TCPCharsAvailable(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- TCPCharsAvailable(paramPtr);
- end;
-
- procedure TCPCharsAvailable(paramPtr: XCmdPtr);
-
- var l: longInt;
- resultStr: Str255;
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
- exit(TCPCharsAvailable);
- end;
-
- {$I TCPUtil.inc}
-
- begin
- if paramPtr^.paramCount <> 1 then Fail('§§§ parameter count is not 1 §§§');
-
- SetUpConnectionID;
-
- { Get the status of the connection. }
- ZeroIOParms;
- SyncControlBlock.csCode := TCPcsStatus;
- if PBControl(@SyncControlBlock,false) <> noErr then Fail('§§§ status call failed §§§');
-
- { Return the number of characters in our buffer, plus the number waiting to be read. }
- LongToStr(paramPtr,ControlWordAtOffset(60)+Connection^.incomingSize,resultStr);
- paramPtr^.returnValue := PasToZero(paramPtr,resultStr)
- end;
-
- end.
-